<template>
  <div class="layui-row home-project-sty">
        <h1 class="project-title-sty">项目</h1>
        <div class="project-sty">
            <continuous-card title="模块" logo="layui-icon-flag"></continuous-card>
            <continuous-card to="/queryInterface" :value="interfaceCount" content="接口数量" title="接口" logo="layui-icon-link"></continuous-card>
            <continuous-card title="状态码" logo="layui-icon-form"></continuous-card>
            <continuous-card title="项目成员" logo="layui-icon-user"></continuous-card>
            <continuous-card to="/queryStandard" :value="standardCount" content="编程规范数量" title="编程规范" logo="layui-icon-fonts-clear"></continuous-card>
            <continuous-card title="bug" logo="layui-icon-face-surprised"></continuous-card>
            <continuous-card title="问题" logo="layui-icon-survey"></continuous-card>
        </div>

  </div>
</template>

<script>
export default {
  data () {
    return {
      standardCount:0,
      interfaceCount:0,
    }
  },
  created(){
    this.getProjectItemCount();
  },
  mounted(){
    layui.element.init();
  },
  methods:{
    getProjectItemCount:function(){
        var url = this.$store.state.RootURL + "/project/item/count";
        var project_id = this.$store.state.projectId;
        var that = this;
        $.ajax({
            url: url,
            type:"get",
            dataType:'json',
            data:{id:project_id},
            success: function(data){
             // console.log("项目子项数量 ： "+JSON.stringify(data));
              that.interfaceCount = KgoUtil.objIsNull(data.data.interfaceCount) ? 0 : data.data.interfaceCount ;
              that.standardCount = KgoUtil.objIsNull(data.data.standardCount) ? 0 : data.data.standardCount ;
            }
        });
    }
  },
 computed: {
    count () {
      return this.$store.state.projectId
    }
  },
  watch: {
    count (newValue, oldValue) {
      this.getProjectItemCount();
    }
  }
}
</script>

<style lang="scss">
.home-project-sty{
  background-color: #FFFFFF;
  padding-top: 15px;
  padding-bottom: 20px;
}
.home-project-sty>.project-title-sty{
  font-size: 2.6em;
  font-weight: 900;
  margin-left: 30px;

}
.home-project-sty>.project-sty{
  margin-left: 20px;
  margin-top: 10px;
  margin-bottom: 20px;
}
</style>
